<?php 
if (isset($_GET['export']) && $_GET['export'] == 1) 
{  
	$num = $_GET['conunt_num'];
	$ok = $_GET['action_ok'];
	$fail = $_GET['action_fail']; 
	$str = "注入cdn总数,注入cdn成功数量,注入cdn失败数量\n";
	$str = iconv('utf-8','gb2312',$str); 
	$conunt_num = iconv('utf-8','gb2312',$num); //中文转码
	$action_ok = iconv('utf-8','gb2312',$ok);
	$action_fail = iconv('utf-8','gb2312',$fail);
	$str .= $conunt_num.",".$action_ok.",".$action_fail."\n"; //用引文逗号分开 
	$filename = '注入统计'.date('YmdHis').'.csv'; //设置文件名
	export_csv($filename,$str); //导出
	die;
} 
function export_csv($filename,$data)
{
	header("Content-type:text/csv");
	header("Content-Disposition:attachment;filename=".$filename);
	//header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
	//header('Expires:0');
	//header('Pragma:public');
	echo $data;
}

?>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<link href="../../nn_cms_manager/css/allstyle.css" rel="stylesheet" type="text/css" />
		<link href="../../nn_cms_manager/css/rightframestyle.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="../../nn_cms_manager/css/dtree.css" type="text/css" />
		<link href="../../nn_cms_manager/css/selectbox.css" rel="stylesheet" type="text/css" />
		<link href="../../nn_cms_manager/css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
		<style>
			#status p {
				padding: 5px;
			}

			#status .red {
				color: #ff0000;
			}
			#status .green {
				color: green;
			}
			#status .glay {
				color: #666666;
			}
			#status span {
				float: right;
			}

			#status {
				font-size: 12px;
				color: #666666;
				background: #eeeeee;
				padding: 5px 10px;
			}

			.header {
				padding: 5px 10px;
				background: #BBD7F0;
				color: #fff;
				font-weight: bold;
			}

			.content_table {
				color: #fff;
			}

			.content_table table thead th {
				background: #eee;
				color: #666;
				font-weight: bold;
				font-size: 14px;
			}
			.inject {
				width: 200px;
			}
			.html_color{
				color: red;
			}
		</style>
		<link href="../../nn_cms_manager/css/allstyle.css" rel="stylesheet" type="text/css" />
		<link href="../../nn_cms_manager/css/rightframestyle.css" rel="stylesheet" type="text/css" />
		<script language="javascript" src="../../nn_cms_manager/js/jquery-1.4.3.min.js"></script>

		<script language="javascript" src="../js/st_task_import_state.js?val=<?php echo time();?>"></script> 
		<script language="javascript" src="../../nn_cms_manager/js/checkinput.js.php"></script>

		<script language="javascript" src="../../nn_cms_manager/js/table.js.php"></script>

		<script type="text/javascript" src="../js/bootstrap.min.js"></script>
		<script type="text/javascript" src="../js/chart.js"></script>
		<link rel="stylesheet" href="../css/demo.css" type="text/css"/>
		<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css"/>

		<script language="javascript" src="../js/cms_datepicker.js"></script>
		<script language="javascript" src="../js/Starcor.S67.js"></script> 
		<script language="javascript"> 
		var timestmp =<?php echo time(); ?>;
			var sp_id = '<?php echo $_GET['sp_id']; ?>';
	var nowtime=<?php echo strtotime(date('Ymd')); ?>;
	function export_info()
	{
		//添加
		var cdn_video_add_ok = $('#cdn_video_add_ok').html();
		var cdn_video_add_wait = $('#cdn_video_add_wait').html();
		var cdn_video_add_do = $('#cdn_video_add_do').html();
		var cdn_video_add_fail = $('#cdn_video_add_fail').html();
		var cdn_index_add_ok = $('#cdn_index_add_ok').html();
		var cdn_index_add_wait = $('#cdn_index_add_wait').html();
		var cdn_index_add_do = $('#cdn_index_add_do').html();
		var cdn_index_add_fail = $('#cdn_index_add_fail').html();
		var cdn_media_add_ok = $('#cdn_media_add_ok').html();
		var cdn_media_add_wait = $('#cdn_media_add_wait').html();
		var cdn_media_add_do = $('#cdn_media_add_do').html();
		var cdn_media_add_fail = $('#cdn_media_add_fail').html();
		//修改
		var cdn_video_modify_ok = $('#cdn_video_modify_ok').html();
		var cdn_video_modify_wait = $('#cdn_video_modify_wait').html();
		var cdn_video_modify_do = $('#cdn_video_modify_do').html();
		var cdn_video_modify_fail = $('#cdn_video_modify_fail').html();
		var cdn_index_modify_ok = $('#cdn_index_modify_ok').html();
		var cdn_index_modify_wait = $('#cdn_index_modify_wait').html();
		var cdn_index_modify_do = $('#cdn_index_modify_do').html();
		var cdn_index_modify_fail = $('#cdn_index_modify_fail').html();
		var cdn_media_modify_ok = $('#cdn_media_modify_ok').html();
		var cdn_media_modify_wait = $('#cdn_media_modify_wait').html();
		var cdn_media_modify_do = $('#cdn_media_modify_do').html();
		var cdn_media_modify_fail = $('#cdn_media_modify_fail').html();
		//删除
		var cdn_video_destroy_ok = $('#cdn_video_destroy_ok').html();
		var cdn_video_destroy_wait = $('#cdn_video_destroy_wait').html();
		var cdn_video_destroy_do = $('#cdn_video_destroy_do').html();
		var cdn_video_destroy_fail = $('#cdn_video_destroy_fail').html();
		var cdn_index_destroy_ok = $('#cdn_index_destroy_ok').html();
		var cdn_index_destroy_wait = $('#cdn_index_destroy_wait').html();
		var cdn_index_destroy_do = $('#cdn_index_destroy_do').html();
		var cdn_index_destroy_fail = $('#cdn_index_destroy_fail').html();
		var cdn_media_destroy_ok = $('#cdn_media_destroy_ok').html();
		var cdn_media_destroy_wait = $('#cdn_media_destroy_wait').html();
		var cdn_media_destroy_do = $('#cdn_media_destroy_do').html();
		var cdn_media_destroy_fail = $('#cdn_media_destroy_fail').html();
		//操作成功
		var action_ok = Number(cdn_video_add_ok) 
		+Number(cdn_index_add_ok) 
		+Number(cdn_media_add_ok) 
		+Number(cdn_video_modify_ok) 
		+Number(cdn_index_modify_ok) 
		+Number(cdn_media_modify_ok) 
		+Number(cdn_video_destroy_ok) 
		+Number(cdn_index_destroy_ok) 
		+Number(cdn_media_destroy_ok);
		//操作等待
		var action_wait  = Number(cdn_video_add_wait) 
		+Number(cdn_index_add_wait) 
		+Number(cdn_media_add_wait) 
		+Number(cdn_video_modify_wait) 
		+Number(cdn_index_modify_wait) 
		+Number(cdn_media_modify_wait) 
		+Number(cdn_video_destroy_wait) 
		+Number(cdn_index_destroy_wait) 
		+Number(cdn_media_destroy_wait);
		//操作执行
		var action_do  = Number(cdn_video_add_do) 
		+Number(cdn_index_add_do) 
		+Number(cdn_media_add_do) 
		+Number(cdn_video_modify_do) 
		+Number(cdn_index_modify_do) 
		+Number(cdn_media_modify_do) 
		+Number(cdn_video_destroy_do) 
		+Number(cdn_index_destroy_do) 
		+Number(cdn_media_destroy_do);
		//操作失败
		var action_fail  = Number(cdn_video_add_fail) 
		+Number(cdn_index_add_fail) 
		+Number(cdn_media_add_fail) 
		+Number(cdn_video_modify_fail) 
		+Number(cdn_index_modify_fail) 
		+Number(cdn_media_modify_fail) 
		+Number(cdn_video_destroy_fail) 
		+Number(cdn_index_destroy_fail) 
		+Number(cdn_media_destroy_fail);
		//算总数
		var conunt_num = Number(action_ok)+Number(action_do)+Number(action_wait)+Number(action_fail); 
		window.location.href='?export=1&conunt_num='+conunt_num+'&action_ok='+action_ok+'&action_fail='+action_fail;  
	}
		</script>
	</head>

	<body>
		<div class="alert alert-danger" style="margin:0px auto;width:300px;position:fixed;z-index:100;float:right;">
			<b>读取中...</b>
		</div>

		<div class="content" style="background:#fff;">
			<div class="content_position" style="padding:10px;"></div>
			<div class="content_table">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
                        <td id="num"></td>
						<td style="padding:10px 25px;">
						<div class="btn-group">
							<button type="button" class="btn btn-primary" id="btn2">
								今日
							</button>
							<button type="button" class="btn btn-primary" id="btn3">
								昨日
							</button>
							<button type="button" class="btn btn-primary" id="btn4">
								前天
							</button>
							<button type="button" class="btn btn-primary" id="btn5">
								前一周
							</button>
							<button type="button" class="btn btn-primary" id="btn6">
								全部
							</button>
						</div></td>
						<td style="padding:10px 25px; z-index:100">
						<input  name="begin_date"  id="begin_date" type="text"
						value="" readonly="readonly" style="width:200px; padding:5px 10px;" class="datepicker"/>
						-
						<input  name="end_date" id="end_date" type="text"
						value="" readonly="readonly"  style="width:200px;padding:5px 10px;"  class="datepicker"/>
						&nbsp;&nbsp;&nbsp;&nbsp;
						<button type="button" class="btn btn-primary"  id="btn7">
							自定义时间查询
						</button></td>
						<td><button type="button" class="btn btn-primary" onclick="export_info();">
							导出
						</button></td>
					</tr>
				</table>
			</div>
			<div class="content_table">
				<div class="header">
					主媒资
				</div>
				<table width="100%" border="1" cellspacing="0" cellpadding="0">
					<thead>
						<tr>
							<th><b>CDN</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="cdn_video_add_do">&nbsp;</td>
							<td class="cdn_video_add_wait">&nbsp;</td>
							<td class="cdn_video_add_ok">&nbsp;</td>
							<td class="cdn_video_add_fail">&nbsp;</td>
							<td class="cdn_video_modify_do">&nbsp;</td>
							<td class="cdn_video_modify_wait">&nbsp;</td>
							<td class="cdn_video_modify_ok">&nbsp;</td>
							<td class="cdn_video_modify_fail">&nbsp;</td>
							<td class="cdn_video_destroy_do">&nbsp;</td>
							<td class="cdn_video_destroy_wait">&nbsp;</td>
							<td class="cdn_video_destroy_ok">&nbsp;</td>
							<td class="cdn_video_destroy_fail">&nbsp;</td>
						</tr>
					</tbody>
					<thead>
						<tr>
							<th><b>EPG</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="epg_video_add_do">&nbsp;</td>
							<td class="epg_video_add_wait">&nbsp;</td>
							<td class="epg_video_add_ok">&nbsp;</td>
							<td class="epg_video_add_fail">&nbsp;</td>
							<td class="epg_video_modify_do">&nbsp;</td>
							<td class="epg_video_modify_wait">&nbsp;</td>
							<td class="epg_video_modify_ok">&nbsp;</td>
							<td class="epg_video_modify_fail">&nbsp;</td>
							<td class="epg_video_destroy_do">&nbsp;</td>
							<td class="epg_video_destroy_wait">&nbsp;</td>
							<td class="epg_video_destroy_ok">&nbsp;</td>
							<td class="epg_video_destroy_fail">&nbsp;</td>
						</tr>
					</tbody>
				</table>
			</div>
			
			<div class="content_table">
				<div class="header">
					分集
				</div>
				<table width="100%" border="1" cellspacing="0" cellpadding="0">
					<thead>
						<tr>
							<th><b>CDN</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="cdn_index_add_do">&nbsp;</td>
							<td class="cdn_index_add_wait">&nbsp;</td>
							<td class="cdn_index_add_ok">&nbsp;</td>
							<td class="cdn_index_add_fail">&nbsp;</td>
							<td class="cdn_index_modify_do">&nbsp;</td>
							<td class="cdn_index_modify_wait">&nbsp;</td>
							<td class="cdn_index_modify_ok">&nbsp;</td>
							<td class="cdn_index_modify_fail">&nbsp;</td>
							<td class="cdn_index_destroy_do">&nbsp;</td>
							<td class="cdn_index_destroy_wait">&nbsp;</td>
							<td class="cdn_index_destroy_ok">&nbsp;</td>
							<td class="cdn_index_destroy_fail">&nbsp;</td>
						</tr>
					</tbody>
					<thead>
						<tr>
							<th><b>EPG</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="epg_index_add_do">&nbsp;</td>
							<td class="epg_index_add_wait">&nbsp;</td>
							<td class="epg_index_add_ok">&nbsp;</td>
							<td class="epg_index_add_fail">&nbsp;</td>
							<td class="epg_index_modify_do">&nbsp;</td>
							<td class="epg_index_modify_wait">&nbsp;</td>
							<td class="epg_index_modify_ok">&nbsp;</td>
							<td class="epg_index_modify_fail">&nbsp;</td>
							<td class="epg_index_destroy_do">&nbsp;</td>
							<td class="epg_index_destroy_wait">&nbsp;</td>
							<td class="epg_index_destroy_ok">&nbsp;</td>
							<td class="epg_index_destroy_fail">&nbsp;</td>
						</tr>
					</tbody>
				</table>
			</div>
			
			<div class="content_table">
				<div class="header">
					片源
				</div>
				<table width="100%" border="1" cellspacing="0" cellpadding="0">
					<thead>
						<tr>
							<th><b>CDN</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="cdn_media_add_do">&nbsp;</td>
							<td class="cdn_media_add_wait">&nbsp;</td>
							<td class="cdn_media_add_ok">&nbsp;</td>
							<td class="cdn_media_add_fail">&nbsp;</td>
							<td class="cdn_media_modify_do">&nbsp;</td>
							<td class="cdn_media_modify_wait">&nbsp;</td>
							<td class="cdn_media_modify_ok">&nbsp;</td>
							<td class="cdn_media_modify_fail">&nbsp;</td>
							<td class="cdn_media_destroy_do">&nbsp;</td>
							<td class="cdn_media_destroy_wait">&nbsp;</td>
							<td class="cdn_media_destroy_ok">&nbsp;</td>
							<td class="cdn_media_destroy_fail">&nbsp;</td>
						</tr>
					</tbody>
					<thead>
						<tr>
							<th><b>EPG</b></th>
							<th colspan="4"><b>添加</b></th>
							<th colspan="4"><b>修改</b></th>
							<th colspan="4"><b>删除</b></th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td rowspan="2" class="inject" style="text-align:center;"></td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
							<td>执行</td>
							<td>等待</td>
							<td>成功</td>
							<td>失败</td>
						</tr>
						<tr>
							<td class="epg_media_add_do">&nbsp;</td>
							<td class="epg_media_add_wait">&nbsp;</td>
							<td class="epg_media_add_ok">&nbsp;</td>
							<td class="epg_media_add_fail">&nbsp;</td>
							<td class="epg_media_modify_do">&nbsp;</td>
							<td class="epg_media_modify_wait">&nbsp;</td>
							<td class="epg_media_modify_ok">&nbsp;</td>
							<td class="epg_media_modify_fail">&nbsp;</td>
							<td class="epg_media_destroy_do">&nbsp;</td>
							<td class="epg_media_destroy_wait">&nbsp;</td>
							<td class="epg_media_destroy_ok">&nbsp;</td>
							<td class="epg_media_destroy_fail">&nbsp;</td>
						</tr> 
					</tbody>
				</table>
			</div> 
		</div> 
	</body>
</html>
